
package bcd2;
import bcd.*;
public class test2 {
    public static void main(String[] args){
        List a=new doublelink();
        List b=new doublelink();
        List c=new doublelink();
        c.insert(0,1);
    c.insert(1,4);
    c.insert(2,4);
    c.insert(3,4);
    b.insert(0,2);
    b.insert(1,3);
    b.insert(2,6);
    b.insert(3,7);
    b.insert(4,8);
    Object g=c.next(4);
    int m,n,k;
    m=n=1;k=0;
    while(m<=c.length()&&n<=b.length()){
        if((int)c.get(m)<=(int)b.get(n)){
            a.insert(k,c.get(m));
            ++k;
            ++m;
        }
        else{
            a.insert(k,b.get(n));
            ++n;
            ++k;
        }
    }     
    while(m<=c.length()){
        a.insert(k, c.get(m));
        ++m;
        ++k;
    }
    while(n<=b.length()){
        a.insert(k, b.get(n));
        ++n;
        ++k;
    }
    
    a.traverse();
    Object j=c.delete(4);
    System.out.println("j="+j);
    c.traverse();
    }
    
}
